//-----------------------------------------------------------------------------
/// STATE_INIT (Implementation)
//-----------------------------------------------------------------------------
START_STATE_CODE( STATE_LOGO )
{
    START_MESSAGE_HANDLER( MESSAGE_ENTER )
    {
		StateLogoInit();
    }

    START_MESSAGE_HANDLER( MESSAGE_UPDATE )
    {		
		StateLogoUpdate();
    }

    START_MESSAGE_HANDLER( MESSAGE_PAINT )
    {
		StateLogoPaint(s_gBackBuffer);
    }

    START_MESSAGE_HANDLER( MESSAGE_EXIT )
    {
		// GameDestroy();
		StateLogoExit();
    }

	START_MESSAGE_HANDLER( MESSAGE_HIDENOTIFY )
	{
		// GameHideNotify();
	}
}

static long s_iLogoStartTime		= 0;

static void StateLogoInit()
{	
	try
	{
		s_iLogoStartTime = System.currentTimeMillis();
	}
	catch(Exception ex)
	{
		System.out.println("!!!! STATE_LOGO error");
	}
}

static void StateLogoUpdate()
{
	long currentTime = 0;
	try{
		currentTime = System.currentTimeMillis();
	}catch(Exception ex){}
	
	if((currentTime - s_iLogoStartTime) > LOGO_DISPLAY_TIME)
	{
		SwitchState(STATE_SPLASHSCREEN);
	}
}

static void StateLogoPaint(Graphics g)
{
	g.drawImage(s_imgBackBuffer,0,0,0);
}

static void StateLogoExit()
{
	s_imgBackBuffer = null;
}